#!/usr/bin/python3

###################################
# 输入输出
# print('键盘输入：')
# keyboard = input("请输入：")
# print("你输入的内容是: ", keyboard)

print('文件操作:')
f = open('./resource/test.txt', 'w+')
size = f.write('write into file...')
print('写入{}个字符'.format(size))
f.close()

f = open('./resource/test.txt', 'r+')
content = f.read()
print(content)
f.close()
print()

###################################
print('文件(反)序列化:')
import pickle
f = open('./resource/serialize.txt', 'wb')
data = {'a': [1, 2, 3], 'b':('x', 'y'), 'c': 'string'}
pickle.dump(data, f)
f.close()

f = open('./resource/serialize.txt', 'rb')
data = pickle.load(f)
print(data)
f.close()
print()
